﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/static/include/top.jsp"%>

<c:set var="status" value=""/>
<c:if test="${requestScope.checkStatus eq '5'}">
	<c:set var="status" value="导出审核通过报表"/>
</c:if>
<c:if test="${requestScope.checkStatus eq '55'}">
	<c:set var="status" value="导出初审通过报表"/>
</c:if>
<c:if test="${requestScope.checkStatus eq '1'}">
	<c:set var="status" value="导出已提交报表"/>
</c:if>
<c:if test="${requestScope.checkStatus eq '3'}">
	<c:set var="status" value="导出审核驳回报表"/>
</c:if>	

<script>document.title="${status}";</script>
<script type="text/javascript">
function openEditWin(url,tit){
	openWin(tit,url,1200,600);
}

function openViewWin(id){
	openWin("审批历史","${ctx}/data/view?id="+id,800,600);
}
function xxx(){
	location.reload(true);
}

$(document).ready(function(){
	$("#unitName").val("${requestScope.userUnit}");
	$("#searchDate").val("${param['searchDate']}");
	$("#endDate").val("${param['endDate']}");
});

function clearInput() {
	$("input").each(function(){
		this.value = "";
	});
}

function exportEIReport(){
	var url = "${baseURL}/dataManage/expReport/${requestScope.checkStatus}";
	layer.confirm("将导出下列查询结果中的所有报表，确认导出？", function(){
		
		var datas = "unitName=" + $("#unitName").val() + "&searchDate=" + $("#searchDate").val() + "&endDate=" + $("#endDate").val();

		$.ajax({
			type:'post',
			dataType:'json',
			url:url,
			data:datas,
			success: function(msg){
				layer.msg(msg, 1, 1);
			},
			error: function(){
				layer.msg("导出失败。", 1);
			}
		});
	});
}
function expReportModel(){
	layer.confirm("确认导出？", function(){			
		$.ajax({
			url:'${baseURL}/dataManage/expReportModel',
			dataType:'json',
			type:'post',
			success : function(msg){
				layer.msg("操作成功!", 1, 1);
			},
			error : function(){
				layer.msg("操作失败!");
			}
		});
	});	
}
</script>

<table>
	<tbody>

		<tr>
			<th><img src="${ctx}/static/images/pages/cen/rig/ico_01.png" align="absmiddle">&nbsp;${status}</th>
		</tr>
		<tr class="tab_grey">
			<td>
				<form name="searchForm" action="" method="get">
					<input type="hidden" name="p" value="1" /> 
					 <span class="tab_text"> 单位名称： </span> <input id="unitName" type="text" name="unitName" value="" size="20"
						class="tab_textbut" />
					<span class="tab_text">开始时间:</span>
					<input	id="searchDate" name="searchDate" onfocus="WdatePicker()" class="Wdate" value="${formdata.startTime}" type="text"  class="tab_textbut" >
					<span class="tab_text">结束时间：</span>			
					<input	id="endDate" name="endDate" onfocus="WdatePicker()" class="Wdate"	value="${formdata.endTime}" type="text"  class="tab_textbut" >

					<a class="tab_but" href="#"
						onclick="searchForm.action='${baseURL}/dataManage/expReportPage/${requestScope.checkStatus}';searchForm.submit();return false;">查询</a>
					<a class="tab_but" href="#" onclick="clearInput();return false;">清空</a><br>

					<a class="tab_but02" href="#" onclick="exportEIReport();">${status}</a>
					
					<c:if test="${requestScope.checkStatus eq '5'}">
						<a class="tab_but02" href="#" onclick="expReportModel();">导出报表模板</a>
					</c:if>
				</form>
				 <iframe name="upload" width="0" height="0" frameborder="0"></iframe>
			</td>
		</tr>

	</tbody>
</table>

<br />
<c:if test="${empty obj.operationResult}">
	<b>没有符合条件的记录。</b>
</c:if>
<c:if test="${not empty obj.operationResult}">

	<table id="listTable">
	<tbody>
		<tr>	
				<th width="20%">报表类型</th>
				<th width="8%">频率</th>
				<th width="8%">报表年份</th>
				<th width="14%">报出时间</th>
				<th width="20%">填报单位</th>
				<th width="10%">填表人</th>
				<th width="10%">审批历史</th>
				<th>操作</th>
				
			
		</tr>
		<c:forEach var="oneRow" items="${obj.operationResult}">

			<tr>
				
				<td align="left" >${oneRow.reportName}</td>
				<td align="left" class="tab_td_rig">${requestScope.reportTimetype[oneRow.reportTimetype]}</td>
				<td align="left" >${oneRow.reportYear}</td>
				<td align="left"><fmt:formatDate value="${oneRow.reportDate}" type="both" pattern="yyyy-MM-dd"/></td>
				<td align="left" >${oneRow.reportUnit}</td>
				<td align="left" >${oneRow.reportFillAdmin}</td>
				
			<td align="left">
			<a href="#" onclick="openViewWin('${oneRow.id}');return false;"><img src="${baseURL}/static/images/tab/ico_01.png" width="16" height="16" border="0" align="absmiddle"/>历史</a></td>
		<td align="left">
			<a href="#" onclick="openEditWin('${baseURL}/reports/service.do?method=showReportInfo&reportOperatorId='+'${userId}'+'&reportId='+'${oneRow.id}','查看'+'${oneRow.reportDomainName}')"><img src="${baseURL}/static/images/tab/ico_01.png" width="16" height="16" border="0" align="absmiddle"/>详情</a>
			
		</td>
			</tr>
		</c:forEach>
		<tr class="tab_grey">
				<td colspan="7" align="center" valign="middle" class="tab_white">
				<div class="pagination"> 
					<%@ include file="../include/listpage2.jsp"%>
				</div>
				<div class="clear"></div>
				</td>
			</tr>	
		
		</tbody>
	</table>
</c:if>

<%@ include file="/static/include/bottom.jsp"%>
